﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.ComponentModel.DataAnnotations;
using Common;

namespace ElectrosLtd.Models
{
    public class RegistrationModel
    {
        public User myUser { get; set; }

        [Required(ErrorMessage = "Username cannot be left empty")]
        [StringLength(20, ErrorMessage = "Maximum length: 20 characters ")]
        public string Username { get; set; }

        [Required(ErrorMessage = "Password cannot be left empty")]
        [MinLength(6, ErrorMessage = "Password must cannot more than 6 characters")]
        public string Password { get; set; }

        [Required(ErrorMessage = "Email address cannot be left empty")]
        [DataType(DataType.EmailAddress)]
        //[RegularExpression(@"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4})", ErrorMessage="Email format is not valid")]
        public string Email { get; set; }

        [Required(ErrorMessage = "Name cannot be left empty")]
        public string FirstName { get; set; }

        [Required(ErrorMessage = "Surname cannot be left empty")]
        public string LastName { get; set; }

        [Required(ErrorMessage = "Address cannot be left empty")]
        public string Address { get; set; }

        [Required(ErrorMessage = "Town cannot be left empty")]
        public string Town { get; set; }

        
        [Required(ErrorMessage = "Mobile number cannot be left empty")]
        
        public string MobileNumber { get; set; }
        public int PIN { get; set; }

        public int CountryID { get; set; }
        public SelectList countryList { get; set; }

        public RegistrationModel()
        {
            countryList = new SelectList(new UsersServ.WCFUsersClient().GetCountries(), "ID", "Name");
        }
    }
}